﻿using System;

namespace Ndns.Packet.Abstractions.ResourceRecords
{
    public sealed class CustomDnsResourceRecord : DnsResourceRecord
    {
        public override DnsHostName HostName { get; set; }
        public override DnsRecordType Type { get; protected set; }
        public override DnsClass Class { get; protected set; }
        public byte[] Data { get; set; }

        public CustomDnsResourceRecord(DnsHostName hostName, DnsClass c, DnsRecordType type, uint ttl)
            : base(hostName, c, ttl)
        {
            Type = type;
        }
        public CustomDnsResourceRecord(DnsHostName hostName, DnsClass c, DnsRecordType type, uint ttl, byte[] data)
            : base(hostName, c, ttl)
        {
            Type = type;
            Data = data ?? throw new ArgumentNullException(nameof(data));
        }


        public override DnsResourceRecord Clone()
        {
            return new CustomDnsResourceRecord(HostName, Class, Type, TTL, Data);
        }

        public override CustomDnsResourceRecord AsCustomDnsResourceRecord()
        {
            return this;
        }
    }
}
